package com.iwinding.ladygg.bluetooth.bean;

import android.bluetooth.BluetoothDevice;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by 82218 on 2017/6/25.
 */

public class BleDevice implements Parcelable {

    public String deviceRssi;//当前连接设备信号
    public String deviceName;//当前连接设备名称
    public String deviceAddress;//当前连接设备地址
    public boolean isConnect;//是否连接
    public BluetoothDevice device;
    public String uuid;

    public BleDevice() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.deviceRssi);
        dest.writeString(this.deviceName);
        dest.writeString(this.deviceAddress);
        dest.writeByte(this.isConnect ? (byte) 1 : (byte) 0);
        dest.writeParcelable(this.device, flags);
    }

    protected BleDevice(Parcel in) {
        this.deviceRssi = in.readString();
        this.deviceName = in.readString();
        this.deviceAddress = in.readString();
        this.isConnect = in.readByte() != 0;
        this.device = in.readParcelable(BluetoothDevice.class.getClassLoader());
    }

    public static final Creator<BleDevice> CREATOR = new Creator<BleDevice>() {
        @Override
        public BleDevice createFromParcel(Parcel source) {
            return new BleDevice(source);
        }

        @Override
        public BleDevice[] newArray(int size) {
            return new BleDevice[size];
        }
    };
}
